/*
 * Copyright (c) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * introduction:
 * @file speaker.h
 * @author Hello Kun (https://space.bilibili.com/475950146)
 * @brief 语音模块驱动程序  串口数据交互，语音指令、数据交互规则见mrobot.h 有关说明。
 *        实现：1.语音控制互联设备，
 *              2.控制机器人移动（带音效），
 *              3.播报温度（需要使用mpu6050配合）
 *              3.app发送emoji至MRobot，MRobot发送至语音模块，产生相应语音回复
 *              4.控制趣味磁吸配件，左手小风扇、光环，右手交通灯
 * @version 0.1
 * @date 2022-04-19
 * 
 * @copyright Copyright (c) 2022
 * 
 */

#ifndef __SPEAKER_H__
#define __SPEAKER_H__

#define SPEAKER_RX_12 12
#define SPEAKER_TX_11 11
#define SUT03_LEN 5 // get、send Commnd length e.g: AA 55 01 55 AA
#define TEMP_LEN 7  // send temperature e.g:AA 55 06 20 06 55 AA

int Speaker_Init();

/**
 * @brief 
 * 
 * @param get_data // eg: AA 55 01 55 AA
                   // Format head + index + data_H data_L + tail
                   // index 01 02 03 04 05 : Turn_left right forward backward circle
                           06 : get temprature cmd
                           07 : watering 
                           08 : shutdown PC              
 * @param data_len 
 * @return int 
 */
int Speaker_read(char *get_data, int data_len);

/**
 * @brief 
 * 
 * @param get_data //eg: AA 55 06 20 06 55 AA
                   //Format head + index + data_H data_L + tail
                   //index 01 :  sound effect_1 咕噜咕噜
                           06 :  temprature 
 * @param data_len  
 * @return int >=0 success else false
 */
int Speaker_write(char *get_data, int data_len);

#endif